package com.gupao.factory.abstr;

import com.gupao.factory.Car;

public abstract class AbstractFactory {

    abstract Car getCar();

    //这段代码可以动态配置
    public Car getCar(String name){
        if ("BMW".equalsIgnoreCase(name)){
            return new BmwFactory().getCar();
        }else if ("Benz".equalsIgnoreCase(name)){
            return new BenzFactory().getCar();
        }else if ("Audi".equalsIgnoreCase(name)){
            return new AudiFactory().getCar();
        }else {
            System.out.println("这个产品生产不出来");
        }
        return null;

    }

}
